package net.zoneland.knowledge.controller.bean;

import com.github.pagehelper.PageHelper;

import java.io.Serializable;

/**
 * 分页.
 * @author zouxia
 */
public class Page implements Serializable {

    private static final int PAGEZERO = 0;

    private static final int PAGENAME_DEFAULT = 1;

    private static final int PAGESIZE_DEFAULT = 10;

    /**
     * 页.
     */
    private int pageNum;

    /**
     * 数量.
     */
    private int size;

    public int getPageNum() {
        return pageNum > PAGEZERO? pageNum:PAGENAME_DEFAULT;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getSize() {
        return size > PAGEZERO ? size : PAGESIZE_DEFAULT;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public com.github.pagehelper.Page setPage() {
        return PageHelper.startPage(getPageNum(), getSize());
    }
}
